test: add PriceSparkline component and unit tests for data point rendering - #576
Merged
Chucks1093 merged 1 commit intoJul 25, 2026
Merged
Conversation
…ering - Create PriceSparkline component rendering SVG path from dataPoints array - Handle 7, 1, and 0 data point edge cases safely - Apply emerald-400 line color when last value > first value - Co-locate tests following existing __tests__/ convention Closes accesslayerorg#572
|
@wagmiiii Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the missing
PriceSparklineSVG component and comprehensive unit tests for rendering the correct number of data points, edge cases, and line color.What changed
src/components/common/PriceSparkline.tsx— New component that accepts adataPoints: number[]prop and renders an SVG<path>polyline. Handles 7+ points (full line), 1 point (circle dot, no path), and 0 points (returns null).src/components/common/__tests__/PriceSparkline.test.tsx— Co-located tests covering all acceptance criteria.Key design decisions
dataPointsdirectly rather than coupling to theCoursemodel (which has nopriceHistoryfield). Integration intoCreatorCardis a follow-up.emerald-400(#34d399) for the positive line color, matching the design system already used inRecentActivityBadge,Change24hBadge, etc.nullso callers see nothing. For 1 data point → renders an SVG with a dot (no line path), which satisfies "no error" without visual breakage.Acceptance criteria checklist
<path>element#34d399) applied when last value > first valueTest output
Follow-ups
PriceSparklineintoCreatorCard.tsxwhen the API providespriceHistorydataSecurity note
No secrets, user input, or auth tokens are involved. The component only renders static SVG from numeric data.
Closes #572